import asyncio
from fastmcp import Client

from fastmcp.client.transports import StreamableHttpTransport


async def main():

    transport = StreamableHttpTransport("http://127.0.0.1:8000/mcp/")

    async with Client(transport=transport) as client:
        print("Connected to server")
        tools = await client.list_tools()
        print("Available tools:", [t.name for t in tools])
        res = await client.call_tool("add", {"a": 1, "b": 2})
        print(res.content[0].text)


if __name__ == "__main__":
    asyncio.run(main())
